package com.facebook.imagepipeline.animated.util;

import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.os.Build.VERSION;
import java.util.Arrays;

public class AnimatedDrawableUtil
{
  private static final int FRAME_DURATION_MS_FOR_MIN = 100;
  private static final int MIN_FRAME_DURATION_MS = 11;

  public static boolean isOutsideRange(int paramInt1, int paramInt2, int paramInt3)
  {
    if ((paramInt1 == -1) || (paramInt2 == -1))
      return true;
    if (paramInt1 <= paramInt2)
    {
      boolean bool2;
      if (paramInt3 >= paramInt1)
      {
        bool2 = false;
        if (paramInt3 <= paramInt2);
      }
      else
      {
        bool2 = true;
      }
      return bool2;
    }
    boolean bool1 = false;
    if (paramInt3 < paramInt1)
    {
      bool1 = false;
      if (paramInt3 > paramInt2)
        bool1 = true;
    }
    return bool1;
  }

  public void appendMemoryString(StringBuilder paramStringBuilder, int paramInt)
  {
    if (paramInt < 1024)
    {
      paramStringBuilder.append(paramInt);
      paramStringBuilder.append("KB");
      return;
    }
    int i = paramInt / 1024;
    int j = paramInt % 1024 / 100;
    paramStringBuilder.append(i);
    paramStringBuilder.append(".");
    paramStringBuilder.append(j);
    paramStringBuilder.append("MB");
  }

  public void fixFrameDurations(int[] paramArrayOfInt)
  {
    for (int i = 0; i < paramArrayOfInt.length; i++)
      if (paramArrayOfInt[i] < 11)
        paramArrayOfInt[i] = 100;
  }

  public int getFrameForTimestampMs(int[] paramArrayOfInt, int paramInt)
  {
    int i = Arrays.binarySearch(paramArrayOfInt, paramInt);
    if (i < 0)
      i = -1 + (-1 + -i);
    return i;
  }

  public int[] getFrameTimeStampsFromDurations(int[] paramArrayOfInt)
  {
    int[] arrayOfInt = new int[paramArrayOfInt.length];
    int i = 0;
    for (int j = 0; j < paramArrayOfInt.length; j++)
    {
      arrayOfInt[j] = i;
      i += paramArrayOfInt[j];
    }
    return arrayOfInt;
  }

  @SuppressLint({"NewApi"})
  public int getSizeOfBitmap(Bitmap paramBitmap)
  {
    if (Build.VERSION.SDK_INT >= 19)
      return paramBitmap.getAllocationByteCount();
    if (Build.VERSION.SDK_INT >= 12)
      return paramBitmap.getByteCount();
    return 4 * (paramBitmap.getWidth() * paramBitmap.getHeight());
  }

  public int getTotalDurationFromFrameDurations(int[] paramArrayOfInt)
  {
    int i = 0;
    for (int j = 0; j < paramArrayOfInt.length; j++)
      i += paramArrayOfInt[j];
    return i;
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.facebook.imagepipeline.animated.util.AnimatedDrawableUtil
 * JD-Core Version:    0.6.2
 */